473,484 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how to use div object dynamically

hello,

i am new to javascript. i want to use DIV object for expand/collapse
the Tree Dynamically like Microsoft explorerer.MY size of the tree
elements are changeing Dynamically. I need some idea or coding for
this purpose.
Can anybody help me.Thanks in advance.

cheers,
raja

Apr 16 '07 #1
3 8686
wrote on 16 apr 2007 in comp.lang.javascript:
i am new to javascript. i want to use DIV object for expand/collapse
the Tree Dynamically
document.getElementById('mydiv').style = 'none';

document.getElementById('mydiv').style = 'block';
like Microsoft explorerer.MY size of the tree
elements are changeing Dynamically. I need some idea or coding for
this purpose.
If you want to programme like some page [the I do not know] why not look at
that code?
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Apr 16 '07 #2
On Apr 15, 11:31 pm, rajachezh...@gmail.com wrote:
hello,
i am new to javascript. i want to use DIV object for expand/collapse
the Tree Dynamically like Microsoft explorerer.MY size of the tree
elements are changeing Dynamically. I need some idea or coding for
this purpose.
Can anybody help me.Thanks in advance.

some simple example;;; works in ie6,ff2,opera9

----
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<style>
#menuTop,#menuTop ul{cursor:default;list-style-type:circle}
#menuTop .m{list-style-type:square}
#menuTop ul{display:none}
</style>
<script>
function showHide(ev){
ev=ev||window.event
var elem=(ev.target||ev.srcElement).getElementsByTagNa me("UL")[0]
if(!elem)return;
elem=elem.style;
elem.display=(elem.display!='block')?'block':'none '
}
</script>
</head>
<body>

<ul onclick="showHide(event)" id="menuTop">
<li>Menu a</li>
<li>Menu b</li>
<li class="m">Menu c
<ul>
<li>Menu ca</li>
<li class="m">Menu cb
<ul>
<li>Menu cca</li>
<li>Menu ccb</li>
<li>Menu ccc</li>
</ul>
</li>
<li>Menu cd</li>
</ul>
</li>
<li>Menu d</li>
<li class="m">Menu e
<ul>
<li>Menu ea</li>
<li>Menu eb</li>
<li>Menu ev</li>
</ul>
</li>
<li>Menu f</li>
</ul>
</body>
</html>
----
Apr 17 '07 #3
On Apr 17, 5:38 am, "scripts.contact" <scripts.cont...@gmail.com>
wrote:
On Apr 15, 11:31 pm, rajachezh...@gmail.com wrote:
hello,
i am new to javascript. i want to use DIV object for expand/collapse
the Tree Dynamically like Microsoft explorerer.MY size of the tree
elements are changeing Dynamically. I need some idea or coding for
this purpose.
Can anybody help me.Thanks in advance.

some simple example;;; works in ie6,ff2,opera9
...

or---

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;
charset=windows-1250">
<meta name="generator" content="PSPad editor, www.pspad.com">
<title></title>
<style>
#menuTop,#menuTop ul{cursor:default;list-style-type:circle}
#menuTop .m{list-style-type:square}
</style>
<script>
function showHide(elem){
elem=elem.getElementsByTagName("UL")[0]
if(!elem)return;
elem=elem.style;
elem.display=(elem.display!='block')?'block':'none '
}

if(document.createStyleSheet){
var styleSheet=document.createStyleSheet();
styleSheet.addRule("#menuTop ul","display:none")
}else if(document.createElement){
var styleSheet=document.createElement("style")
styleSheet.type="text/css"
styleSheet.textContent="#menuTop ul{display:none}"
document.getElementsByTagName("head")
[0].appendChild(styleSheet)
}
</script>
</head>
<body>
<ul onclick="showHide(event.target||event.srcElement)" id="menuTop">
<li>Menu a</li>
<li>Menu b</li>
<li class="m">Menu c
<ul>
<li>Menu ca</li>
<li class="m">Menu cb
<ul>
<li>Menu cca</li>
<li>Menu ccb</li>
<li>Menu ccc</li>
</ul>
</li>
<li>Menu cd</li>
</ul>
</li>
<li>Menu d</li>
<li class="m">Menu e
<ul>
<li>Menu ea</li>
<li>Menu eb</li>
<li>Menu ev</li>
</ul>
</li>
<li>Menu f</li>
</ul>
</body>
</html>


the document will look good and show all the menus if either
javascript OR css is disabled :)

Apr 17 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5561
by: Roman Gordin | last post by:
Hi, I use SVG for web-GUI, but found some serious restrictions 8-( When I use HTML (dynamically generated from .php), I may use HTTPRequest object to provide dynamically regeneration some part...
1
2734
by: Ron Vecchi | last post by:
I am using the FlashShockWave COM object. in the form design mode I specified the Flash Movie .SWF local path. and it loads correctly. My problem is that if I make changes to the swf file it...
1
1022
by: Reza Nabi | last post by:
Bakground: I have a webform (LoadCtl.aspx) which loads the user control to a placeholder dynamically based on the ctlName querystring passed in the URL. Webform (LoadCtl.aspx) also passes a...
12
1987
by: Belebele | last post by:
Suppose that a class A depends on class B because an object of class B is passed into A's constructor. See below: class B { ... }; class A { public: A(B const& b); ... };
4
5662
by: marcosnogood | last post by:
Hello, I need to dynamically load an activex object because what object to load is based on certain conditions. Also I need to wait for the object to have initialized before moving on. What I...
23
1912
by: digitalorganics | last post by:
How can an object replace itself using its own method? See the following code: class Mixin: def mixin(object, *classes): NewClass = type('Mixin', (object.__class__,) + classes, {}) newobj =...
7
2505
by: Ron Goral | last post by:
Hello I am new to creating objects in javascript, so please no flames about my coding style. =) I am trying to create an object that will represent a "div" element as a menu. I have written...
10
2550
by: Jess | last post by:
Hello, If I create a temporary object using a dynamically created object's pointer, then when the temporary object is destroyed, will the dynamically created object be destroyed too? My guess...
9
4974
by: grbgooglefan | last post by:
I am trying to pass a C++ object to Python function. This Python function then calls another C++ function which then uses this C++ object to call methods of that object's class. I tried...
1
1585
by: =?Utf-8?B?Q2hhcmxlcw==?= | last post by:
I'm running VS2008 & attempting to solve a problem I've encountered while developing some software for our business. Here's the basic idea...I've created a class that represents a file (with...
0
6943
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7152
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5399
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4833
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4523
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3041
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3034
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1346
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
228
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.